<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/index.css">
    <script src="./logon/js.js"></script>
</head>

<body>
    <p>欢迎来到我的世界</p>
    <div class="box">世界开辟中......</div>
    <div class="logOut">
        离开异次元
    </div>
    <script>
        let logOut = document.getElementsByClassName("logOut")[0];

        function timi() {
            return JSON.parse(localStorage.userName);
        }

        function ti(a) {
            return timi().user.indexOf(a);
        }
        logOut.onclick = function() {
            if (confirm("确认要离开吗，目前次元坐标很不稳定，离开后就找回不来了哟")) {
                let username = timi();
                // console.log(ti(timi()))
                username.user.splice([ti(timi().getUser)], 1);
                username.password.splice([ti(timi().getUser)], 1);
                localStorage.userName = JSON.stringify(username);

                // localStorage.removeItem(timi().user[ti(timi().getUser)]);
                location.href = "./logon/logon.html";
            }
        }
    </script>
</body>

</html>